package com.mj.scence.area.view
{
	import com.mj.model.ConstCC;
	import com.mj.vo.AreaData;
	import com.notice.NoticeCC;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	import resLib.UI;

	public class AreaScenceV extends Sprite
	{
		private var marginX:int = 100;
		private var marginY:int = 40;
		
		
		public function AreaScenceV()
		{
		}
		
		//添加区域块
		public function addArea(areaData:AreaData, index:uint):void
		{
			var block:MovieClip = UI.getMovieClip("Area");
			block.name = "area"+areaData.id.value;
			if(index>1)
				block.x = marginX;
			block.y = (index % 2)*marginY;
			switch(index)
			{
				case 0:
					block.areaName.text = "乞丐区";
					break;
				case 1:
					block.areaName.text = "新手级区";
					break;
				case 2:
					block.areaName.text = "初级区";
					break;
				case 2:
					block.areaName.text = "高级区";
					break;
			}
			block.discription.text = "金额下限:"+areaData.low+"\n"+
				"金额上限:"+areaData.high+"\n"+
				"一番金额:"+areaData.silver+"\n"+
				"可携带:"+(areaData.percent.value*100)+"%\n"+
				"在线:"+areaData.online+"\n"+
				"在线妹子:"+areaData.female;
			block.buttonMode = true;
			block.useHandCursor =  true;
			block.addEventListener(MouseEvent.CLICK, enterGameScence);
			this.addChild(block);
			
		}
		
		private function enterGameScence(evt:MouseEvent):void
		{
			NoticeCC.dispatch(ConstCC.PAGE_TO_GAME_SCENCE, int(evt.currentTarget.name.replace("area","")));
		}
	}
}